package com.example.springcloud.consumer.student.cloudclient;

import com.example.springcloud.common.entity.ResponseResult;
import com.example.springcloud.common.entity.Student;
import com.example.springcloud.consumer.student.cloudclient.fallback.ProviderStudentFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "provider-student",fallback = ProviderStudentFallback.class, contextId = "studentFeignClient")
public interface StudentFeignClient {
    @PutMapping("/student")
    ResponseResult<?> addStudent(@RequestBody Student student);

    @GetMapping("/student/{id}")
    ResponseResult<?> findStudent(@PathVariable("id") int id);

    @GetMapping("/student")
    ResponseResult<?> findAllStudents();

    @DeleteMapping("/student/{id}")
    ResponseResult<?> deleteStudent(@PathVariable("id") int id);

    @PostMapping
    ResponseResult<?> updateStudent(@RequestBody Student student);

    @GetMapping("/time/ok")
    ResponseResult<?> getOk();

    @GetMapping("/time/out")
    ResponseResult<?> getOut();
}
